using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using PetaPoco;

namespace BlazorAdmin.Models
{
	[PrimaryKey("ID")]
	[TableName($"{nameof(Job)}s")]
	public class Job
	{
        /// <summary>
        /// 主键
        /// </summary>
		[NotNull]
		[DisplayName("主键")]
		public int ID { get; set; }

        /// <summary>
        /// 获取或设置 任务编码 Allow Null
        /// </summary>
		[NotNull]
		[DisplayName("任务编码")]
		[MaxLength(50, ErrorMessage = "{0}不能超过 50 个字符")]
		public string JobCode { get; set; }

        /// <summary>
        /// 获取或设置 任务名称 Allow Null
        /// </summary>
		[NotNull]
		[DisplayName("任务名称")]
		[MaxLength(200, ErrorMessage = "{0}不能超过 200 个字符")]
		public string JobName { get; set; }

        /// <summary>
        /// 获取或设置 触发条件 Allow Null
        /// </summary>
		[NotNull]
		[DisplayName("触发条件")]
		[MaxLength(100, ErrorMessage = "{0}不能超过 100 个字符")]
		public string CronExpress { get; set; }

        /// <summary>
        /// 获取或设置 上次执行时间 Allow Null
        /// </summary>
		[AllowNull]
		[DisplayName("上次执行时间")]
		public DateTime? LastExecTime { get; set; }

        /// <summary>
        /// 获取或设置 上次执行结果 Allow Null
        /// </summary>
		[AllowNull]
		[DisplayName("上次执行结果")]
		public string LastExecResult { get; set; }

        /// <summary>
        /// 获取或设置 下次执行时间 Allow Null
        /// </summary>
		[AllowNull]
		[DisplayName("下次执行时间")]
		public DateTime? NextExecTime { get; set; }

        /// <summary>
        /// 获取或设置 任务状态 Allow Null
        /// </summary>
		[NotNull]
		[DisplayName("任务状态")]
		[MaxLength(10, ErrorMessage = "{0}不能超过 10 个字符")]
		public string Status { get; set; }

        /// <summary>
        /// 获取或设置 更新人 Allow Null
        /// </summary>
		[AllowNull]
		[DisplayName("更新人")]
		[MaxLength(30, ErrorMessage = "{0}不能超过 30 个字符")]
		public string Updater { get; set; }

        /// <summary>
        /// 获取或设置 更新时间 Allow Null
        /// </summary>
		[AllowNull]
		[DisplayName("更新时间")]
		public DateTime? UpdateTime { get; set; }
	}
}
